import { defineStore } from 'pinia'
import { templateState } from '../types'
import STORE_NAMES from '../store-names'


const useTemplateStore = defineStore(STORE_NAMES.TEMPLATE, {
  state: (): templateState => {
    return {
      templateInfo: new Map<string, any>()
    }
  },
  getters: {

  },
  actions: {
    setTemplateInfo(data: { key: string, value: any, getList: Function }): void {
      const { key, value, getList } = data
      this.templateInfo.set(key, value)
      getList()
    }
  }
})

export default useTemplateStore